<!-- invoice start-->
<section>
    <div class="panel panel-primary">
        <!--<div class="panel-heading navyblue"> INVOICE</div>-->
        <div class="panel-body">
            <div class="row invoice-list">
                <div class="text-center corporate-id">
                    <img src="img/vector-lab.jpg" alt="">
                </div>
                <div class="col-lg-4 col-sm-4">
                    <h4>BILLING ADDRESS</h4>
                    <p>
                        Jonathan Smith <br>
                        44 Dreamland Tower, Suite 566 <br>
                        ABC, Dreamland 1230<br>
                        Tel: +12 (012) 345-67-89
                    </p>
                </div>
                <div class="col-lg-4 col-sm-4">
                    <h4>SHIPPING ADDRESS</h4>
                    <p>
                        Vector Lab<br>
                        Road 1, House 2, Sector 3<br>
                        ABC, Dreamland 1230<br>
                        P: +38 (123) 456-7890<br>
                    </p>
                </div>
                <div class="col-lg-4 col-sm-4">
                    <h4>INVOICE INFO</h4>
                    <ul class="unstyled">
                        <li>Invoice Number		: <strong>69626</strong></li>
                        <li>Invoice Date		: 2013-03-17</li>
                        <li>Due Date			: 2013-03-20</li>
                        <li>Invoice Status		: Paid</li>
                    </ul>
                </div>
            </div>
            <table class="table table-striped table-hover">
                <thead>
                    <tr>
                        <th>#</th>
                        <th>Item</th>
                        <th class="hidden-phone">Description</th>
                        <th class="">Unit Cost</th>
                        <th class="">Quantity</th>
                        <th>Total</th>
                    </tr>
                </thead>
                <tbody>
                    <?php $i=1; ?>
                    <?php
                        $precioParcial = 0;
                        $subtotal = 0;
                        $total = 0;
                    ?>
                    <?php foreach($datosPedido['Item'] as $dpi): ?>
                    <tr>
                        <td><?php echo $i; ?></td>
                        <td><?php echo $dpi['Producto']['nombre']; ?></td>
                        <td class="hidden-phone"><?php echo substr($dpi['Producto']['resumen'], 0, 30); ?> ...</td>
                        <td class=""><?php echo $dpi['Producto']['precio']; ?></td>
                        <?php
                            $precio = $dpi['precio'];
                            //debug($precio);
                            $cantidad = $dpi['cantidad'];
                            //debug($cantidad);
                            $precioParcial = $precio * $cantidad;
                            //debug($precioParcial);\
                            $subtotal += $precioParcial; 
                            $tax = $datosPedido['Pedido']['tax'];
                            $shipping = $datosPedido['Pedido']['shipping'];
                            $total = $subtotal + $tax + $shipping;
                        ?>
                        <td class=""><?php echo $dpi['cantidad']; ?></td>
                        <td>$ <?php echo $precioParcial; ?></td>
                    </tr>      
                    <?php $i++; ?>
                   <?php endforeach; ?>
                </tbody>
            </table>
            <div class="row">
                <div class="col-lg-4 invoice-block pull-right">
                    <ul class="unstyled amounts">
                        <li><strong>Sub - Total amount :</strong> $<?php echo $subtotal; ?></li>
                        <li><strong>Shipping :</strong> <?php echo $datosPedido['Pedido']['shipping']; ?></li>
                        <li><strong>Tax :</strong> <?php echo $datosPedido['Pedido']['tax']; ?></li>
                        <li><strong>Grand Total :</strong> $<?php echo $total; ?></li>
                    </ul>
                </div>
            </div>
            <div class="text-center invoice-btn">
                <a href="<?php echo $this->Html->url(array('controller'=>'pedidos', 'action'=>'pagado', $datosPedido['Pedido']['id'])); ?>" class="btn btn-danger btn-lg"><i class="icon-check"></i> Submit Invoice </a>
                <a class="btn btn-info btn-lg" onclick="javascript:window.print();"><i class="icon-print"></i> Print </a>
            </div>
        </div>
    </div>
</section>
<!-- invoice end-->